Skip to content

POC Canton demo integration#167

Merged
thibauld merged 25 commits intodevfrom
cantonDemo
Jun 12, 2025
Merged

POC Canton demo integration#167
thibauld merged 25 commits intodevfrom
cantonDemo

Conversation

@HardlyDifficult
Copy link
Copy Markdown
Collaborator

What?

POC of how we might integrate Canton for the upcoming demo. It makes just the first Canton call we might need.

  • yarn local
  • node src/examples/testTransfer.mjs

Why?

Validate the approach / seeking tips on how to get started.

Screenshots (optional)

Screenshot 2025-06-10 at 11 12 37 AM

@HardlyDifficult HardlyDifficult changed the base branch from dev to main June 10, 2025 15:31
@HardlyDifficult HardlyDifficult changed the base branch from main to dev June 10, 2025 15:31
cursor[bot]

This comment was marked as outdated.

@HardlyDifficult HardlyDifficult requested a review from Copilot June 12, 2025 15:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a proof-of-concept integration with Canton for onchain operations, enabling specialized handling for transfers, issuances, stock classes, and cap table deployments when the chain ID corresponds to Canton.

  • Added new schema fields and branch logic to handle Canton-specific operations
  • Integrated new modules under src/chain-operations/canton for issuance, transfer, stock class and cap table deployments
  • Updated configuration files, ESLint and Prettier ignores, and submodules to support the Canton integration

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/db/objects/Stakeholder.js Added new fields (party_id, stock_position_contract_id)
src/db/objects/Issuer.js Added party_id field
src/controllers/transactions/transferController.js Integrated Canton branch for transfer operations via new helper
src/controllers/transactions/issuanceController.js Updated issuance flow to conditionally invoke Canton-specific logic
src/controllers/stockClassController.js Updated stock class controller signature to support Canton handling
src/chain-operations/issuanceControllerCanton.js Added Canton-specific issuance function
src/chain-operations/getProvider.js Throws an error for Canton chains, indicating unsupported behavior
src/chain-operations/getContractInstances.js Logs unsupported Canton chain and returns null
src/chain-operations/deployCapTable.js Updated deployCapTable to branch for Canton integration
src/chain-operations/canton/* New modules for Canton-specific chain operations and configuration
eslint.config.js, .prettierignore, .gitmodules, .env.example Adjusted config files to include Canton-related paths and settings

Comment thread src/chain-operations/canton/constants.js
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@thibauld thibauld merged commit 65c5d1a into dev Jun 12, 2025
2 checks passed
@thibauld thibauld deleted the cantonDemo branch June 12, 2025 21:33
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Issuer Creation Fails on Canton Chains

The deployCapTable function was updated to accept a fourth issuer argument, which is then passed to deployCapTableCanton for Canton chains. deployCapTableCanton attempts to access properties like issuer.legal_name and issuer.party_id. However, the /issuer/create-fairmint-reflection route in src/routes/issuer.js was not updated and still calls deployCapTable with only three arguments. Consequently, when this route is used for a Canton chain ID, the issuer parameter is undefined, leading to a TypeError ("Cannot read properties of undefined") and preventing issuer creation.

src/chain-operations/deployCapTable.js#L23-L30

};
async function deployCapTable(issuerId, initial_shares_authorized, chainId, issuer) {
if (isCantonChainId(chainId)) {
return deployCapTableCanton(issuerId, initial_shares_authorized, chainId, issuer);
}
// Get provider for specified chain

src/routes/issuer.js#L124-L135

console.log("💾 | Issuer id in bytes16 ", issuerIdBytes16);
const { address, deployHash } = await deployCapTable(issuerIdBytes16, incomingIssuerToValidate.initial_shares_authorized, chain_id);
const incomingIssuerForDB = {
...incomingIssuerToValidate,
deployed_to: address,
tx_hash: deployHash,
chain_id: Number(chain_id),
};
const issuer = await createIssuer(incomingIssuerForDB);

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants